import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';


/**
 * 分页查询
 */
export async function page<T = any>(body: API.SshInfoPage) {
    return request<API.ResultPageVO<API.SshInfo>>(apiPrefixDispose('/sshInfo/page'), {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
    });
  }

/**
 * ssh集合
 */
export async function listSSH<T = any>() {
    return request<API.ResultVO<API.SshInfo[]>>(apiPrefixDispose('/sshInfo/lists'), {
      method: 'GET',
    });
  }

/**
 * 根据ID获取详情
 */
export async function info<T = any>(id: number) {
    return request<API.ResultVO<API.SshInfo>>(apiPrefixDispose(`/sshInfo/${id}`), {
      method: 'GET',
    });
  }


  /**
   * 新增服务器ssh连接信息
   */
  export async function append<T = any>(
    body: API.SshInfoAdd,
    options?: { [key: string]: any },
  ) {
    return request<API.ResultVO<string>>(apiPrefixDispose(`/sshInfo/append`), {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
      ...(options || {}),
    });
  }


/**
 * 删除服务器ssh连接信息
 */
export async function deleteByIds<T = any>(
    codes: Array<number>,
    options?: { [key: string]: any },
  ) {
    return request<API.ResultVO<string>>(apiPrefixDispose(`/sshInfo/delete`), {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: codes,
      ...(options || {}),
    });
  }


/**
 * 编辑服务器ssh连接信息
 */
export async function edit<T = any>(body: API.SshInfoEdit) {
    return request<API.ResultVO<string>>(apiPrefixDispose('/sshInfo/edit'), {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      data: body,
    });
  }
